<template>
  <scroll id="scroll">
    <div class="menu-list">
      <div
        v-for="(item, index) in category"
        :key="index"
        class="menu-list-item"
        :class="{active:currentIndex == index}"
        @click="itemClick(index)"
      >
        <p>{{ item.title }}</p>
      </div>
    </div>
  </scroll>
</template>

<script>
import scroll from "components/common/scroll/Scroll";

export default {
  name: "CategoryLeftMenu",
  components: {
    scroll,
  },
  props: {
    category: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  data() {
    return {
      currentIndex: 0,
    };
  },
  methods: {
    itemClick(index) {
      this.currentIndex = index
      this.$emit('selectItem',index)
    },
  },
};
</script>

<style scoped>

.menu-list {
  min-width: 80px;
}
.menu-list-item {
  padding: 15px 0;
  font-size: 14px;
  text-align: center;
  background-color: #f6f6f6;
}
.menu-list-item p {
  padding: 0 10px;
  border-left: 4px solid transparent;
}
.active {
  background-color: #ffffff;
}
.active p {
  font-weight: 700;
  color: var(--color-high-text);
  border-color: var(--color-tint);
}
</style>